<template>
	<view class="page cart">
		<v-bottom-tab :tabList="tabs" @clicked="changeTab" :currentIndex="currentIndex"></v-bottom-tab>
	</view>
</template>

<script>
import { mapState } from 'vuex'
import vBottomTab from '../../components/v-bottom-tab/v-bottom-tab.vue'
export default {
	components: {
		vBottomTab
	},
	data() {
		return {
			currentIndex: 0,
			tabs:[{
					"pagePath": "pages/index/index",
					"iconPath": "static/img/tab_home.png",
					"selectedIconPath": "static/img/tab_home_select.png",
					"text": "首页"
				},
				{
					"pagePath": "pages/category/category",
					"iconPath": "../../static/img/tab_category.png",
					"selectedIconPath": "static/img/tab_category_select.png",
					"text": "分类"
				},
				{
					"pagePath": "pages/cart/cart",
					"iconPath": "static/img/tab_cart.png",
					"selectedIconPath": "static/img/tab_cart_select.png",
					"text": "购物车"
				},
				{
					"pagePath": "pages/center/center",
					"iconPath": "static/img/tab_center.png",
					"selectedIconPath": "static/img/tab_center_select.png",
					"text": "个人中心"
				}
			]
		}
	},
	onLoad() {
		// 如果用户未登录，强制进行登录
		if(!this.isLogin){
			uni.navigateTo({url: '../login/login'})
		}
	},
	computed: {
		...mapState(['isLogin'])
	},
	methods:{
		changeTab(index){
			this.currentIndex = index
			/* uni.switchTab({
				url: '../category/category'
			}) */
		}
	}
}
</script>

<style lang="less">

</style>
